home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
d_b_a
/
87_01
/
stateval.prg
< prev
next >
Wrap
Text File
|
1986-12-05
|
1KB
|
41 lines
* STATEVAL.PRG
*
* written by: Bob Green date : 04/26/86
* modified: 08/24/86
* Copyright 1986, Data Based Solutions, Inc.
* All Rights Reserved
*
* this is a GETFILE program to validate the field entered is a
* valid U.S.P.S. two-letter state abbreviation.
*
* the calling program must use a statement as follows:
*
* @ xx,yy SAY "desired input text" GET variable PICTURE "!!" ;
* GETFILE stateval.prg
*
* this routine works with dBMAN V2.0 or later
* set up a getfile-routine field containing the name of
* the `get' field that was `read' by the calling program
STORE GETNAME() TO y.getfld
* set up a variable containing the valid state abbrev's
STORE "AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|"+;
"KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NY|"+;
"NC|ND|OH|OK|OR|PA|PR|RI|SC|SD|TN|TX|UT|VT|VA|WA|"+;
"WV|WI|WY" TO y.valid_st
* use a macro substitution for the field name when determining
* if the field READ was valid
IF INSET("|",&y.getfld,y.valid_st) = 0
* the field entered is not valid, write an error message on the
* screen, and perform your standard validation error routine
STORE "'"+&y.getfld+"' IS NOT A VALID STATE" TO m_errmsg
DO errmsg.prg
* force the same field to be READ again
ASSIGN USERSTAT(0)
ENDIF
RETURN